/*
 * panelSlider.java
 *
 * Created on 13 de mayo de 2008, 02:11 PM
 */

package view;

import java.awt.Image;
import java.awt.event.ActionListener;
import java.awt.event.KeyListener;
import javax.swing.ImageIcon;

/**
 *
 * @author  Daniel
 */
public class PanelSlider extends javax.swing.JPanel {

    /** Creates new form panelSlider */
    public PanelSlider() {
        initComponents();
    }
    
    public void setImage(Image img)
    {        
        labelImage.setIcon(new ImageIcon(img));        
    }
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jScrollPane1 = new javax.swing.JScrollPane();
        labelImage = new javax.swing.JLabel();
        panelProperties = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        textName = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        textCat = new javax.swing.JTextField();
        textConf = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        textSize = new javax.swing.JTextField();
        buttonModif = new javax.swing.JButton();
        buttonFav = new javax.swing.JButton();
        buttonBack = new javax.swing.JButton();
        buttonNext = new javax.swing.JButton();
        jPanel1 = new javax.swing.JPanel();
        jScrollPane2 = new javax.swing.JScrollPane();
        textDescription = new javax.swing.JTextArea();

        labelImage.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        labelImage.setVerticalAlignment(javax.swing.SwingConstants.TOP);
        labelImage.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
        jScrollPane1.setViewportView(labelImage);

        panelProperties.setBorder(javax.swing.BorderFactory.createTitledBorder("Properties"));

        jLabel2.setText("Name");

        textName.setColumns(10);

        jLabel3.setText("Category");

        textCat.setColumns(10);
        textCat.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                textCatActionPerformed(evt);
            }
        });

        textConf.setColumns(10);

        jLabel4.setText("confidential");

        jLabel5.setText("Size");

        textSize.setColumns(10);
        textSize.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                textSizeActionPerformed(evt);
            }
        });

        buttonModif.setText("Modify");
        buttonModif.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonModifActionPerformed(evt);
            }
        });

        buttonFav.setText("add to favorites");

        buttonBack.setText("<<");

        buttonNext.setText(">>");

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Description"));

        textDescription.setColumns(20);
        textDescription.setRows(5);
        jScrollPane2.setViewportView(textDescription);

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 145, Short.MAX_VALUE)
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 130, Short.MAX_VALUE)
        );

        javax.swing.GroupLayout panelPropertiesLayout = new javax.swing.GroupLayout(panelProperties);
        panelProperties.setLayout(panelPropertiesLayout);
        panelPropertiesLayout.setHorizontalGroup(
            panelPropertiesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelPropertiesLayout.createSequentialGroup()
                .addComponent(buttonBack, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(buttonNext, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
            .addGroup(panelPropertiesLayout.createSequentialGroup()
                .addGap(12, 12, 12)
                .addGroup(panelPropertiesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(panelPropertiesLayout.createSequentialGroup()
                        .addComponent(jLabel2)
                        .addGap(29, 29, 29))
                    .addComponent(jLabel5)
                    .addComponent(jLabel4)
                    .addComponent(jLabel3))
                .addGap(1, 1, 1)
                .addGroup(panelPropertiesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(panelPropertiesLayout.createSequentialGroup()
                        .addGap(2, 2, 2)
                        .addComponent(textConf, 0, 0, Short.MAX_VALUE))
                    .addGroup(panelPropertiesLayout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(textSize))
                    .addGroup(panelPropertiesLayout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(textCat))
                    .addGroup(panelPropertiesLayout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(textName)))
                .addGap(21, 21, 21))
            .addGroup(panelPropertiesLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addGroup(panelPropertiesLayout.createSequentialGroup()
                .addGap(33, 33, 33)
                .addGroup(panelPropertiesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(buttonModif, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(buttonFav, javax.swing.GroupLayout.Alignment.LEADING))
                .addContainerGap(37, Short.MAX_VALUE))
        );

        panelPropertiesLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {textCat, textConf, textName, textSize});

        panelPropertiesLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonBack, buttonNext});

        panelPropertiesLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonFav, buttonModif});

        panelPropertiesLayout.setVerticalGroup(
            panelPropertiesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelPropertiesLayout.createSequentialGroup()
                .addGroup(panelPropertiesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(textName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(panelPropertiesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(textCat, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel3))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(panelPropertiesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5)
                    .addComponent(textSize, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(panelPropertiesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(textConf, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(buttonModif)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(buttonFav)
                .addGap(45, 45, 45)
                .addGroup(panelPropertiesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(buttonNext, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(buttonBack, javax.swing.GroupLayout.DEFAULT_SIZE, 34, Short.MAX_VALUE)))
        );

        panelPropertiesLayout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {buttonBack, buttonNext});

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(panelProperties, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 495, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(panelProperties, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 421, Short.MAX_VALUE)
                .addContainerGap())
        );
    }// </editor-fold>//GEN-END:initComponents

private void buttonModifActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonModifActionPerformed
    
}//GEN-LAST:event_buttonModifActionPerformed

private void textCatActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_textCatActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_textCatActionPerformed

private void textSizeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_textSizeActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_textSizeActionPerformed

public void addModifyActionListener(ActionListener evt)
{
    buttonModif.addActionListener(evt);
}


public void addFavActionListener(ActionListener evt)
{
    buttonFav.addActionListener(evt);
}

public void setTextName(String nn)
{
    textName.setText(nn);
}

public void setTextCat(String nc)
{
    textCat.setText(nc);    
}

public void setTextSize(String nz)
{
    textSize.setText(nz);    
}

public void setTextConf(String nc) {
    textConf.setText(nc);
}


//----------Get
public String getTextName()
{
    return textName.getText();
}

public String getTextCat()
{
    return textCat.getText();
}

public String getTextSize()
{
    return textSize.getText();
}

public boolean getTextConf() {
    if(textConf.getText().equals("false"))
        return false;
    else
        return true;
}

public String getDescription()
{
    return textDescription.getText();
}

public void setNameKeyListener(KeyListener k)
{
    textName.addKeyListener(k);
}

public void setCatKeyListener(KeyListener k)
{
    textCat.addKeyListener(k);
}

public void setSizeKeyListener(KeyListener k)
{
    textSize.addKeyListener(k);
}

public void setConfKeyListener(KeyListener k)
{
    textConf.addKeyListener(k);
}

public void setNextActionListener(ActionListener e)
{
    buttonNext.addActionListener(e);
}

public void setBackActionListener(ActionListener e)
{
    buttonBack.addActionListener(e);
}

public void setFavActionListener(ActionListener e)
{
    buttonFav.addActionListener(e);
}
public void setModifActionListener(ActionListener e)
{
    buttonModif.addActionListener(e);
}

public void setDesText(String txt)
{
    textDescription.setText(txt);
}



    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton buttonBack;
    private javax.swing.JButton buttonFav;
    private javax.swing.JButton buttonModif;
    private javax.swing.JButton buttonNext;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JLabel labelImage;
    private javax.swing.JPanel panelProperties;
    private javax.swing.JTextField textCat;
    private javax.swing.JTextField textConf;
    private javax.swing.JTextArea textDescription;
    private javax.swing.JTextField textName;
    private javax.swing.JTextField textSize;
    // End of variables declaration//GEN-END:variables

}
